<template>
	<view class="registration">
		<!-- <view class="payment-header" @click="close()">
			<view class="give">
				课程报名费用，付款给“{{ name }}”
			</view>
			<view class="company">
				{{ company }}
			</view>
			<image :src="img" mode="" class="icon"></image>
		</view> -->
		<view class="form">
			<view class="" style="font-size: 35upx; margin: 0upx 0 10upx 30upx; border-left: 6upx solid #DD524D; text-indent: 20upx;font-weight: 500;">
				活动名称：
			</view>
			<view style="font-size: 35upx; margin: 30upx 0 30upx 50upx; text-indent: 20upx;">
				{{avtivity_title}}
			</view>
			<view class="" style="font-size: 28upx; margin: 0upx 0 10upx 30upx; border-left: 6upx solid #DD524D; text-indent: 20upx;">
				请正确填写报名信息，老师优先排课
			</view>
			<view style="padding-left: 60rpx;margin: 20rpx 0;">
				<image style="display: inline-block;vertical-align: middle;width: 70rpx;border-radius: 50%;"  mode="widthFix" :src="kh_customer.avatar"></image>
				<text style="display: inline-block;font-size: 28rpx;margin-left: 15rpx;">{{kh_customer.nickname}}</text>
			</view>
			<!-- <view class="row" v-for="(item,index) in form_field" :key="index">
				<view class="lab">
					<view class="warn" v-if="item.name.required == 1">*</view>{{item.name.name}}:
				</view>
				<input class="input" :placeholder="item.name.placeholder" type="text" value="" v-model="item.value" />
			</view> -->
			<view class="row" v-for="(item,index) in info" :key="index">
				<view class="lab">
					<view class="warn">*</view>{{item.custom_field_name}}:
				</view>
				<input disabled="disabled" class="input" type="text" value="" v-model="item.custom_field_value" />
			</view>
			<view class="" style="margin-bottom: 30upx;padding: 10rpx 0;">
				<view style="margin-left: 30upx; font-size: 30upx;">
					<view class="warn">*</view>家长付款金额
				</view>
				<view class="payment">
					<view>￥</view>
					<input type="digit" :focus="isfocus" v-model="keyNumber" @input="valueClick" placeholder="0.00" />
				</view>
			</view>			
		</view>
		<view class="footer">
			带<view style="display: inline-block; color: red;">“*”</view>标示为必填项目
			<!-- <view v-if="commission == 1" style="width: 700upx;overflow: hidden;">
				<view style="width: 720upx;border-top: 1px solid rgba(0,0,0,0.13);margin-top: 40upx;" v-if="courseList!=''"><text class="congratulations">恭喜你，获得特权购课名额</text><text class="prompt">（不需要可以取消勾选）</text></view>
				<radio-group class="uni-list">
					<label v-for="(item,index) in courseList" :key="index" v-if="item.status!=0">
						<view class="olinecourse">
						<view style="float: left;margin-top: 60upx;"><radio color="#FF8B46" :checked="item.checked" @click="radioChanges(index)"></radio></view>
						<view class="topleft"><image style="width: 100%;height: 100%;" :src="item.img" mode="aspectFit"></image></view>
						<view class="topright"><text style="color: #000000;">{{item.titles}}</text></view>
						<view><text style="color: red;font-size: 50upx;">￥{{item.special_price}}</text><text style="text-decoration: line-through;font-size: 30upx;">原价:{{item.original_price}}</text></view>
						</view>
					</label>
				</radio-group>
			</view> -->
		</view>
		<!-- <view>{{token}}</view> -->
		<view style="border-left: 1rpx #33a3dc solid;margin: 0 0 100rpx 30rpx;padding: 10rpx;">
			<view style="font-size: 28rpx;font-weight: 500;border-left: 6rpx solid #DD524D;padding-left: 15rpx;margin-bottom: 20rpx;">招生老师备注：</view>
			<textarea v-model="desc" placeholder="请输入家长备注信息" auto-height="true" height="10" style="background-color: #d3d7d4;border-radius: 20rpx;padding: 30rpx;" ></textarea>
		</view>
		<button class="unbtn" v-if="!btnShow">立刻支付</button>
		<button class="btn" v-if="btnShow" @click="daifu_handlePay2()">共计￥{{total_price.toFixed(2)}}立即支付</button>
		<!-- <view class="mask">
			
		</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				desc:"",
				courseList:[],
				formData: {
					kemu: "",
					name: '',
					phone: "",
					age: "",
					six: "",
					height: "",
				},
				total_price:0,
				name: '',
				company: '',
				img: '',
				keyNumber: '',
				order_detail: {},
				btnShow: false,
				isfocus: true,
				form_field: '',
				flag: false,
				currentBrowser: '',
				saveState: false ,// addH5是否调用判断
				appid:'',
				imglink: this.$store.state.imgLink,
				online_courses_id:undefined,
				price:0,
				commission:0,
				online_courses_off:0,
				token:'',
				avtivity_title:'',
				kh_customer:'',
				info:'',
				order_id:0,
			}
		},
		onLoad(option) {
			this.browserJudgment()
			console.log("dds",option)
			this.order_id=option.orderid
			let dataa1 = {
				token:option.token,
				order_id:option.orderid
			};
			this.$api.get_order_custom_info(dataa1).then(res => {
				if(res.status){
					console.log(res.list[0].students[0],"^^^^^^^7878^^^^^^^^^^")
					this.avtivity_title = res.list[0].course_name
					this.info = res.list[0].students[0]
				}else{
					uni.showToast({
						title:res.msg,
						icon:'none',
						duration:2000
					})
				}
			}).catch(err => {
				
				uni.showToast({
					title:err,
					icon:'none',
					duration:2000
				})
			})
			
			this.$api.gain_order_act_detail(dataa1).then(res => {
				this.kh_customer=res.data.kh_customer
			})
			let pages = getCurrentPages()
			let currentPge = pages[0].$route.fullPath
			let token = option.token;
			if (token) {
				uni.setStorageSync('token', token);
			}
			let store_id = parseInt(option.store_id, 10);
			if (!store_id > 0) {
				store_id = uni.getStorageSync('store_id')
			} else {
				uni.setStorageSync('store_id', store_id)
			}
			this.store_id = store_id
			this.activity_id = parseInt(option.activity_id)
			console.log('加载中');
			uni.showLoading({
				title: '正在加载中...',
				mask: true
			});
			this.getFormMsg(this.activity_id)
			this.$store.commit('updateStoreId', store_id)
			
			console.log(this.$store.state.URL + "/customer/user/wx_login?page=" + currentPge + '&shared_customer_id=' +
					option.customer_id)
			if (!this.$store.getters.getToken) {
				location.href = this.$store.state.URL + "/customer/user/wx_login?page=" + currentPge + '&shared_customer_id=' +
					option.customer_id
				// location.href = this.$store.state.URL + "/customer/user/wx_login?page=" + currentPge + '&activity_id=' + this.options
				// 	.activity_id + '&shared_customer_id=' + option.customer_id + "&store_id=" + option.store_id
			}
			if (isNaN(option.customer_id)) {
				uni.setStorageSync('shared_customer_id', 0)
			} else {
				uni.setStorageSync('shared_customer_id', parseInt(option.customer_id, 10))
			}
			//如果用户已登录并且通过他人分享进入
			if (this.$store.getters.getToken && uni.getStorageSync('shared_customer_id')) {

				this.bindActivityRelation()
			}

			//  去除分享链接中分享者的token
			const stateObj = currentPge
			let pattern = /(&token+.*&)|(&token+.*)/
			currentPge = currentPge.replace(pattern, '&')
			history.replaceState(stateObj, "", currentPge)
			
			//-----------
			this.$api.getActivity_id({order_id:option.orderid}).then(res => {
				this.activity_id=res.data.activity_id
			})
			let data = {
				// token:this.$store.getters.getToken,
				activity_id: option.activity_id
			}
			this.$api.gain_all_act(data).then(res => {
				console.log(res.list.data[0],"7788")
				this.online_courses_id=res.list.data[0].online_courses_id
				// console.log(this.courseList)
				if (res.status) {
					this.itemAct = res.list.data[0]
				} else {
					uni.showToast({
						title: res.msg,
						icon: "none",
						duration: 2000
					})
				}
				this.getCourseList()
			}).catch(err => {
				console.log(err)
			})

			//用户信息
			const data1 = {
				customer_id: option.customer_id,
				store_id: this.$store.getters.getStoreId
			}
			this.$api.getCustomerInfo(data1).then(res => {
				console.log(res)
				if (res.status) {
					this.img = res.data.userinfo.avatar
					this.name = res.data.userinfo.nickname
				}
			}).catch(err => {
				console.log(err)
			})
			//店铺销售信息
			const data2 = {
				token: this.$store.getters.getToken,
				customer_store_id: this.$store.getters.getStoreId
			}
			this.$api.gain_shop_msg(data2).then(res => {
				console.log(res)
				if (res.status) {
					this.company = res.data.name
				}
			}).catch(err => {
				console.log(err)
			})
		},
		onShow() {
			//  this.orderTime = this.$store.state.orderTime
			//  console.log(this.orderTime)
		},
		watch: {
			saveState: function(val) {
				if (val == true) {
					// if (typeof this.tradeNO != "undefined") {
					// 	location.href = this.$store.state.URL + "/order/order/huifu_taipai_alipay_html?token=" + this.$store.getters.getToken +
					// 		"&tradeNO=" + this.tradeNO
					// 	return;
					// }
				}
				this.saveState = false
			},
			keyNumber: function(val) {
				if (val != '') {
					this.btnShow = true
					if(this.commission==1){
						this.total_price=Number(this.keyNumber)+Number(this.price);
					}else{
						this.total_price=Number(this.keyNumber)
					}
				} else {
					this.btnShow = false
					if(this.commission==1){
						this.total_price=Number(this.keyNumber)+Number(this.price);
					}else{
						this.total_price=Number(this.keyNumber)
					}
				}
			},
			form_field: {
				handler(newValue, oldValue) {
					this.flag = false
					for (let i = 0; i < newValue.length; i++) {
						if (newValue[i].name.required == 0) {
							this.flag = true
						} else {
							if (newValue[i].value != "") {
								this.flag = true
							} else {
								this.flag = false
							}
						}

						if (!this.flag) {
							break;
						}
					}

				},
				deep: true

			}
		},
		methods: {
			sendSuccessMSG(data){
				this.$api.daifu_successMessage(data).then(res => {
					console.log(res,"kkkk")
				})
			},
			daifu_handlePay2(){
				const that = this
				if (!parseFloat(this.keyNumber) > 0) {
					uni.showToast({
						title: '金额必须为正数',
						duration: 2000,
						icon: "none",
						position: "top",
						mask: true
					});
					return false
				}
				//给后台插入一张order_custom_info表的数据用
				let selectCourses = []
				selectCourses.push({
					activity_course_id: this.itemAct.course_msg[0].activity_course_id,
					name: this.itemAct.name,
					image: this.itemAct.image[0],
					price: this.total_price,
					quantity: 1,
					cash_shopping_card_amount: 0,
				})
				// console.log( uni.getStorageSync('shared_customer_id'),"参数selectCourses")
				// return
				//邀请人用户id
				let shareCustomerId = uni.getStorageSync('shared_customer_id')
				if (!parseInt(shareCustomerId, 10) > 0) {
					shareCustomerId = 0
				}
				let data={}
				//获取课程选取的填写信息
				let is_list=false
				if(this.courseList.length!=0){
					if(this.courseList[0].checked){
						is_list=true
					}
				}
				if(this.commission!=0&&is_list){
					uni.setStorageSync("pay_link",this.courseList[0].pay_link)
					data = {
						token: this.$store.getters.getToken,
						desc:this.desc,
						activity_id: this.activity_id,
						telephone: "",
						buy_method: 4,
						money: this.total_price,
						coupon_id: 0,
						order_id: this.order_id, //团购邀请
						shared_customer_id: shareCustomerId,
						courses: JSON.stringify(selectCourses),
						course: JSON.stringify(this.form_field),
						online_courses_id:this.courseList[0].id,
						// #ifdef H5
						in_type:'H5',
						// #endif
						// #ifdef MP-WEIXIN
						in_type:'min',
						// #endif
					}
				}else{
					data = {
						token: this.$store.getters.getToken,
						desc:this.desc,
						activity_id: this.activity_id,
						telephone: "",
						buy_method: 4,
						money: this.total_price,
						coupon_id: 0,
						order_id: this.order_id, //团购邀请
						shared_customer_id: shareCustomerId,
						courses: JSON.stringify(selectCourses),
						course: JSON.stringify(this.form_field),
						// #ifdef H5
						in_type:'H5',
						// #endif
						// #ifdef MP-WEIXIN
						in_type:'min',
						// #endif
					}
				}
				this.$api.zhifuDaifuOrder(data).then(res => {
					if (res.status) {
						const orderId = res.order_id
						that.order_id = orderId
						that.gainData()
						if (res.actual_total > 0) {
							console.log('应付金额为' + res.actual_total + '，执行支付', that.order_id);
							console.log('payInfo', payInfo)
							if( res.pay_type == 'A' ){
								console.log("支付宝端",res);
								var asd = JSON.parse(res.data.body)
								var gko = JSON.parse(asd.jsonData)
								let a = JSON.parse(gko.payInfo)
								
								that.tradeNO = a.tradeNO
								console.log(that.courseList,"？？？？？？？？？？？？？？？？？？？？？？");
								if (typeof that.tradeNO != "undefined") {
									if(that.courseList.length>0&&that.courseList[0].pay_link_open==1&&that.courseList[0].checked&&that.courseList[0].pay_link_open){
										// location.href = this.$store.state.URL + "/order/order/huifu_taipai_alipay_html?token=" + this.$store.getters.getToken + 
										// 	"&tradeNO=" + that.tradeNO + "&url=" + that.courseList[0].pay_link
									}else{
										// location.href = this.$store.state.URL + "/order/order/huifu_taipai_alipay_html?token=" + this.$store.getters.getToken +
										// 	"&tradeNO=" + that.tradeNO + "&url=https://t.tuanhaoke.cn/pages/memberCenter/memberCenter"
									}
									return;
								}
								// let data={
								// 	token:uni.getStorageSync("token"),
								// 	order_id:orderId,
								// 	store_id:this.$store.getters.getStoreId
								// }
								// that.sendSuccessMSG(data)
								uni.redirectTo({
									url:'/pages/memberCenter/personPerformance/signupInfo?store_id='+that.$store.getters.getStoreId+'&order_id='+orderId
								})
							}else if( res.pay_type == 'W' ){
								console.log("微信端");
								console.log(res.type,"？？？？？？？？？？？？？？？？？？？？？？？？？？？？？？？？？");
								if( res.type == 'min_pay' ){
									var payInfo = JSON.parse(res.data.res)
									console.log('orderAdd',payInfo,"微信支付");
									that.jsApiCall(that.$store.getters.getStoreId, orderId, payInfo)
								}else if( res.type == 'huifu_pay' ){
									var payInfo = res.data
									that.appid = res.appId
									console.log('orderAdd',payInfo,"汇付支付");
									that.jsApiCall(that.$store.getters.getStoreId, orderId, payInfo)
								}
							}
						}
					} else {
						console.log("失败了")
						uni.showToast({
							title: res.msg,
							icon: 'none',
							duration: 2000
						})
					}
				
				}).catch(err => {
				
					uni.showToast({
						title: err.errMsg,
						icon: 'none',
						duration: 2000
					})
				})
			},
			getCourseList(){
				let data={
					token:this.$store.getters.token,
					customer_store_id:this.$store.getters.getStoreId
				}
				this.$api.get_online_courses(data).then(res=>{
					console.log(res.list.length,"9977",this.online_courses_id)
					for(let i=0;i<res.list.length;i++){
						if(res.list[i].status!=0){
							res.list[i].checked=true
						}else{
							res.list[i].checked=false
						}
						// res.list[i].special_price=0.01
						console.log("进来了",res.list[i].id,this.online_courses_id)
						if(res.list[i].id==this.online_courses_id){
							this.price+=Number(res.list[i].special_price)
							if(res.list[i].title.length>20){
								res.list[i].titles=res.list[i].title.slice(0,20)+"..."
							}else{
								res.list[i].titles=res.list[i].title
							}
							this.courseList.push(res.list[i])
							console.log("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++")
						}
					}
					this.$api.gain_shop_msg(data).then(res=>{
						this.reward_new_user_money=res.data.reward_new_user_money
						if(res.data.open_recommend==1){
							if(this.itemAct.open_online_courses==1){
								this.commission=res.data.open_recommend
							}
							this.online_courses_off=res.data.open_recommend
						}
						console.log(res.data,"tisi")
					})
					console.log(this.courseList,"ceshi")
				})
			},
			radioChanges(index){
				this.courseList[index].checked=!this.courseList[index].checked
				if(this.courseList[index].checked){
					console.log(Number(this.keyNumber),Number(this.price))
					this.total_price=0;
					if(this.commission==1){
						this.total_price=Number(this.keyNumber)+Number(this.price);
					}else{
						this.total_price=Number(this.keyNumber)
					}
				}else{
					this.total_price=0;
					this.total_price=Number(this.keyNumber);
				}
				console.log(this.total_price)
			},
			valueClick() {
				if (this.keyNumber>0) {
					this.btnShow = true;
				} else {
					this.btnShow = false;
				}
				console.log("执行了",this.btnShow)
			},
			bindActivityRelation() {

				let data = {
					token: this.$store.getters.getToken,
					shared_customer_id: uni.getStorageSync('shared_customer_id'),
					activity_id: this.activity_id,
				}
				this.$api.bind_activity_relation(data).then(res => {
					console.log(res)
					if (res.status) {

					} else {
						uni.showToast({
							title: res.msg,
							icon: "none",
							duration: 2000
						})
					}
				}).catch(err => {
					console.log(err)
				})
			},
			// 调用微信JS api 支付
			jsApiCall(storeId, orderId, jsonWechat) {
				
				let that=this
				console.log('调取支付API');
				let redirectUrl = '/pages/memberCenter/memberCenter?store_id=' + storeId
				uni.setStorageSync('redirectUrl', redirectUrl)
				console.log(jsonWechat, 'jsonWechat')
				console.log(jsonWechat.appId, 'jsonWechat.appId')
				if( this.appid != '' ){
					jsonWechat.appId = this.appid
				}
				WeixinJSBridge.invoke('getBrandWCPayRequest', {
					"appId": jsonWechat.appId,
					"nonceStr": jsonWechat.nonceStr,
					"package": jsonWechat.package,
					"paySign": jsonWechat.paySign,
					"signType": jsonWechat.signType,
					"timeStamp": jsonWechat.timeStamp
				}, function(res) {
					// alert(JSON.stringify(res));

					if (res.err_msg == "get_brand_wcpay_request:ok") {
						console.log('调取支付成功');
						let data={
							token:uni.getStorageSync("token"),
							order_id:orderId
						}
						that.sendSuccessMSG(data)
						uni.redirectTo({
							url:'/pages/memberCenter/personPerformance/signupInfo?store_id='+storeId+'&order_id='+orderId
						})
						// if(that.courseList.length>=1&&that.courseList[0].pay_link_open==1&&that.courseList[0].checked){
						// 	if(that.commission==1){
						// 		console.log("1")								
						// 		// uni.redirectTo({
						// 		// 	url: '/pages/memberCenter/out/out?url='+that.courseList[0].pay_link
						// 		// })
						// 	}else{
						// 		console.log("2")
						// 		let data={
						// 			orderId:orderId
						// 		}
						// 		that.$api.get_by_out_trade_no(data).then(res=>{
						// 			window.location.href=res.online_courses.pay_link
						// 		})
						// 	}
						// }else{
						// 	console.log("3")
						// 	let data={
						// 		orderId:orderId
						// 	}
						// 	that.$api.get_by_out_trade_no(data).then(res=>{
						// 		window.location.href=res.online_courses.pay_link
						// 	})
							
						// 	// window.location.href="https://tool.tuanhaoke.cn/wk/%E7%AB%8B%E5%88%BB%E6%89%AB%E7%A0%81%E9%A2%86%E5%8F%96%E6%82%A8%E7%9A%84%E9%99%90%E6%97%B6%E7%89%B9%E6%9D%83%E7%A6%8F%E5%88%A9.jpeg"
						// 	// uni.redirectTo({
						// 		// url: '/pages/memberCenter/out/out?url='+""
						// 	// })
						// }

					} else {
						
						let data={
							order_id:orderId
						}
						that.$api.orderById(data).then(res => {
							let order = res.list[0]
								
							if(order.type == 0){
								that.$api.deleteByOrderId(data).then(res => {
									console.log(res.msg)
								})
							}
						})
						
						console.log('调取支付失败');
						// uni.showToast({
						// 	title:'取消支付',
						// 	icon:'none',
						// 	duration:2000
						// })
					}
				});
			},
			// 获取表单信息
			getFormMsg(id) {
				let data = {
					token: this.$store.getters.getToken,
					activity_id: id
				}
				let that = this
				this.$api.together_order_msg(data).then(res => {
					if (res.status) {
						let data = res.res
						this.form_field = []
						data.forEach(item => {
							let res = {
								"custom_field_id": '',
								"name": {
									"field_id": '',
									"name": "",
									"required": 1,
									"status": 1
								},
								"value": ''
							}
							res.custom_field_id = item.name.field_id;
							res.name.field_id = item.name.field_id;
							res.name.name = item.name.name;
							res.name.placeholder = '请填写' + item.name.name;
							res.name.status = item.name.status;
							res.name.required = item.name.required
							// res.name.value=1
							// res.value='1'
							this.form_field.push(res)
						})

						console.log(this.form_field, 'AAAAMMMMMMMMMMMMM');
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none',
							duration: 2000
						})
					}
					setTimeout(function() {
						uni.hideLoading();
					}, 100);
					console.log('加载完成');
				}).catch(err => {
					console.log(err)
				})
			},
			uploadInformation() {
				console.log('保存信息');
				let course = []
				course.push({
					"activity_id": this.order_detail.activity_id,
					"activity_course_id": this.order_detail.activity_courses[0].activity_course_id,
					"order_activity_course_id": this.order_detail.activity_courses[0].order_activity_course_id,
					"forms": [{
						chooseAddreId: 0,
						form_field: this.form_field
						// "form_field": [{
						// 		"custom_field_id": 261,
						// 		"name": {
						// 			"field_id": 261,
						// 			"name": "报名科目",
						// 			"required": 1,
						// 			"status": 1
						// 		},
						// 		"value": this.formData.kemu
						// 	},
						// 	{
						// 		"custom_field_id": 262,
						// 		"name": {
						// 			"field_id": 262,
						// 			"name": "孩子姓名",
						// 			"required": 1,
						// 			"status": 1
						// 		},
						// 		"value": this.formData.name
						// 	},
						// 	{
						// 		"custom_field_id": 263,
						// 		"name": {
						// 			"field_id": 263,
						// 			"name": "联系电话",
						// 			"required": 1,
						// 			"status": 1
						// 		},
						// 		"value": this.formData.phone
						// 	},
						// 	{
						// 		"custom_field_id": 264,
						// 		"name": {
						// 			"field_id": 264,
						// 			"name": "孩子年龄",
						// 			"required": 1,
						// 			"status": 1
						// 		},
						// 		"value": this.formData.age
						// 	},
						// 	{
						// 		"custom_field_id": 265,
						//  		"name": {
						// 			"field_id": 265,
						// 			"name": "孩子性别",
						//  			"required": 1,
						// 			"status": 1
						// 		},
						// 		"value": this.formData.six
						// 	},
						// 	{
						// 		"custom_field_id": 266,
						// 		"name": {
						// 			"field_id": 266,
						// 			"name": "身高（选填）",
						// 			"required": 0,
						// 			"status": 1
						// 		},
						// 		"value": this.formData.height
						// 	}
						// ]
					}]
				})
				let signupdata = {
					token: this.$store.getters.getToken,
					order_id: this.order_detail.order_id,
					activity_id: this.order_detail.activity_id,
					customer_telephone: this.formData.phone,
					course: JSON.stringify(course)
				}
				//  请求接口
				console.log(signupdata,"78")
				this.$api.course_user_msg(signupdata).then(res => {
					console.log(res)
					// console.log("123")
					if (res.status) {
						this.$api.gain_shop_msg({
							customer_store_id: this.store_id
						}).then(res => {
							console.log("123")
							if (!res.data.is_recommend) {
								this.saveState = true
								// setTimeout(()=> {
								// 	this.saveState = false
								// 	uni.navigateTo({
								// 		url:"/pages/memberCenter/memberCenter?store_id=" + this.store_id
								// 	})
								// },1000)
							} else {
								this.saveState = true
								// setTimeout(()=> {
								// 	this.saveState = false
								// 	uni.navigateTo({
								// 		url:"/pages/memberCenter/collectioncode/collectioncode/receive?store_id=" + this.store_id+"&activity_id="+this.order_detail.activity_id
								// 	})
								// },1000)
							}

						})

					}
				}).catch(err => {
					console.log("123")
					console.log(err)
				})

			},
			gainData() {
				let data = {
					token: this.$store.getters.getToken,
					store_id: this.store_id,
					order_id: this.order_id
				}
				let that = this
				this.$api.gain_order_act_detail(data).then(res => {
					console.log(res)
					if (res.status) {
						that.order_detail = res.data
						console.log('获取信息');
						that.uploadInformation()
					}
				}).catch(err => {
					console.log(err)
				})
			},
			
			// 判断当前环境是微信还是支付宝
			browserJudgment() {
				// #ifdef H5
						var ua = window.navigator.userAgent.toLowerCase();
						if (ua.match(/MicroMessenger/i) == 'micromessenger') {
							this.currentBrowser = 'WeChat'
							console.log('微信端')
						} else if (ua.match(/Alipay/i) == "alipay") {
							this.currentBrowser = 'Alipay'
							console.log('支付宝端')
						} else {
							this.currentBrowser = 'OtherBrowser'
							console.log('其他浏览器');
						}
				// #endif
				// #ifdef MP-WEIXIN
						this.currentBrowser= '小程序'
				// #endif	
			}
		}
	}
</script>

<style>
	.prompt{
		width: 132px;
		height: 17px;
		font-family: PingFangSC-Regular;
		font-size: 12px;
		color: rgba(0,0,0,0.65);
		letter-spacing: 0;
		font-weight: 400;
	}
	.congratulations{
		width: 140px;
		height: 20px;
		font-family: PingFangSC-Regular;
		font-size: 14px;
		color: rgba(0,0,0,0.85);
		letter-spacing: 0;
		font-weight: 400;
	}
	.olinecourse{
		/* box-shadow: 0 4upx 18upx 0 rgba(0,0,0,0.13);
		border: solid rgba(0,0,0,0.13) 1px;
		border-left: none;border-right: none;border-bottom: none; */
		padding: 35upx;
		padding-left: 0upx;
		padding-right: 0upx;
		width: 690upx;
		/* margin-left: 30upx; */
	}
	
	.label{
		width: 140upx;
		height: 300upx;
		background-image: required("https://tool.tuanhaoke.cn/static/image/member/orangelabel.svg");
	}
	.topleft{
		width: 200upx;
		height: 150upx;
		/* position: relative;
		left: 0upx; */
		float: left;
	}
	.topright{
		width: 350upx;
		height: 100upx;
		font-size: 30upx;
		/* font-weight: bold; */
		float: left;
	},
	.registration {
		position: fixed;
		height: 100%;
		width: 100%;
		background: #F3F3F4;
		overflow: auto;
	}

	/* 	.registration .header{
		font-family: PingFangSC-Medium;
		font-size: 36upx;
		color: #333333;
		letter-spacing: -0.39upx;
		margin-top: 32upx;
		margin-left: 30upx;
		font-weight: bold;
	} */
	.payment-header {
		width: 100%;
		height: 130upx;
		overflow: auto;
		background-color: #F7F7F7;
	}

	.give {
		margin-top: 48upx;
		margin-left: 30upx;
		font-size: 28upx;
	}

	.company {
		margin-top: 8upx;
		margin-left: 30upx;
		font-size: 28upx;
		color: #999999;
		letter-spacing: 0;
	}

	.payment-header .icon {
		position: absolute;
		top: 30upx;
		right: 16upx;
		width: 70upx;
		height: 70upx;
		border-radius: 58upx;
	}

	.registration .form {
		margin-top: 30upx;
		padding-top: 20upx;
		background-color: #ffffff;
	}

	.row {
		height: 80upx;
		margin-left: 30upx;
		border-bottom: 1upx solid #DEDEDE;
	}

	.warn {
		display: inline-block;
		margin-right: 10upx;
		color: #FF391F;
	}

	.lab {
		position: absolute;
		display: inline-block;
		font-size: 28upx;
		color: #000000;
		letter-spacing: -0.3upx;
		margin-top: 20upx;
	}

	.row .input {
		width: 500upx;
		position: absolute;
		margin-top: 8upx;
		margin-left: 170upx;
		font-size: 28upx;
		height: 60upx;
	}

	.registration .footer {
		font-size: 24upx;
		color: #999999;
		letter-spacing: -0.26upx;
		margin-bottom: 50upx;
		margin-left: 30upx;
		margin-top: 17upx;
	}

	.registration .btn {
		width: 662upx;
		color: #ffffff;
		font-size: 28upx;
		text-align: center;
		border-radius: 44upx;
		border: none;
		outline: none;
		box-shadow: 0 4px 12px 0 rgba(250, 176, 48, 0.55);
		background-image: linear-gradient(90deg, #FE9543 14%, #FF664F 100%);
		position: fixed;
		bottom: 5upx;
		left: 50upx;
	}

	.unbtn {
		width: 662upx;
		color: #ffffff;
		font-size: 28upx;
		text-align: center;
		border-radius: 44upx;
		border: none;
		outline: none;
		/* box-shadow: 0 0px 30px #eeeeee; */
		background-color: #F6CDAB;
		position: fixed;
		bottom: 5upx;
		left: 50upx;
		/* background-image: linear-gradient(90deg, #FE9543 14%, #FF664F 100%); */
	}
	
	.registration .mask {
		position: fixed;
		top: 832upx;
		left: 40upx;
		width: 675upx;
		height: 100upx;
		background: rgba(243, 243, 244, 0.6);
	}

	.payment {
		margin-top: 10upx;
		margin-left: 28upx;
		border-bottom: 0.5upx solid #DEDEDE;
	}

	.payment view {
		display: inline-block;
		vertical-align: middle;
		margin-right: 20upx;
		font-size: 60upx;
	}

	.payment input {
		display: inline-block;
		caret-color: orange;
		text-indent: 10upx;
		height: 60upx;
		font-size: 50upx;
		width: 600upx;
		vertical-align: middle;
		letter-spacing: 0;
	}
</style>